def fun1(n):
    res = 1
    i = 1
    while i <= n:
        res *= i
        i += 1
    return res

def fun2(k):
    res01 = 0
    i = 1
    while i <= k:
        res01 += fun1(i)
        i += 3
    return res01

if __name__ == '__main__':
    result = fun2(50)
    print(result)